import React, { Component } from 'react';
import { Tab } from '@icedesign/base';
import Comprehensive from '../Comprehensive/Comprehensive';
import SimilarCompany from '../SimilarCompany/SimilarCompany';
import DrawPage from '../DrawPage/DrawPage';
import '../../baseConfig';
import './BusinessPerformance.scss';

const TabPane = Tab.TabPane;

export default class BusinessPerformance extends Component {
  static displayName = 'BusinessPerformance';

  constructor(props) {
    super(props);
    this.state = {
      activeKey: localStorage.getItem("sid") ? localStorage.getItem("sid") : "0",
    };
  }

  componentDidMount() {
  
    window.onload=function(){
        document.onkeydown=function(){
            var e=window.event||arguments[0];
            if(e.keyCode==123){
                return false;
            }else if((e.ctrlKey)&&(e.shiftKey)&&(e.keyCode==73)){
                return false;
            }
        };
        document.oncontextmenu=function(){
            return false;
        }
    }

    if(GetUrlParam("sid")){
      this.setState({
        activeKey:GetUrlParam("sid")
      })
    }
  }

  stabChange = (key) => {
    localStorage.setItem("sid",key)
    if(key==2){
      window.location.href = `${global.constants.GOLDEYELOCALHOST}gdBeta2/#/evaluate/comparisonData?secu_code=${GetUrlParam("secu_code")}`
    }else{}
    this.setState({
      activeKey:key
    })
  }

  render() {
    return (
      <div>
        {/* activeKey={this.state.activeKey} */}
        <Tab prefix="pre-" onChange={this.stabChange.bind(this)} activeKey={this.state.activeKey}>
          <TabPane tab="综合评价" key="0">
            <Comprehensive />
          </TabPane>

          <TabPane tab="相似聚类" key="1">
            <SimilarCompany />
          </TabPane>

          <TabPane tab="竞品对比" key="2">
            {/* <FeatureAnalysisPage /> */}
          </TabPane>
          <TabPane tab="作图工具" key="3">
            <DrawPage />
          </TabPane>

          {/* <TabPane tab="财务简报下载" key={4}></TabPane> */}
        </Tab>
      </div>
    );
  }
}
